import java.io.File;
import java.util.Properties;

public class StartTest {
    public static void main(String[] args) {
        System.out.println("=== Review服务配置检查 ===");

        // 1. 检查配置文件
        File configFile = new File("src/main/resources/application.properties");
        System.out.println("1. 配置文件存在: " + configFile.exists());

        if (configFile.exists()) {
            try (java.io.FileInputStream fis = new java.io.FileInputStream(configFile)) {
                Properties props = new Properties();
                props.load(fis);
                System.out.println("   服务端口: " + props.getProperty("server.port"));
                System.out.println("   应用名称: " + props.getProperty("spring.application.name"));
                System.out.println("   数据库URL: " + props.getProperty("spring.datasource.url"));
                System.out.println("   数据库用户: " + props.getProperty("spring.datasource.username"));
            } catch (Exception e) {
                System.out.println("   读取配置文件失败: " + e.getMessage());
            }
        }

        // 2. 检查Java文件
        String[] javaFiles = {
            "src/main/java/org/example/Main.java",
            "src/main/java/org/example/review/dto/WorkDTO.java",
            "src/main/java/org/example/review/controller/WorkController.java",
            "src/main/java/org/example/review/service/WorkService.java",
            "src/main/java/org/example/review/mapper/WorkMapper.java"
        };

        System.out.println("\n2. Java文件检查:");
        for (String file : javaFiles) {
            File f = new File(file);
            System.out.println("   " + file + ": " + (f.exists() ? "存在" : "缺失"));
        }

        // 3. 检查POM文件
        File pomFile = new File("pom.xml");
        System.out.println("\n3. POM文件: " + (pomFile.exists() ? "存在" : "缺失"));

        System.out.println("\n=== 检查完成 ===");
        System.out.println("如果以上检查都正常，请运行以下命令启动服务:");
        System.out.println("java -jar target/travel-service-review-0.0.1-SNAPSHOT.jar");
    }
}